#include <QApplication>
#include <QCoreApplication>
#include <QTranslator>
#include <QDebug>

#include "mainwindow.h"
#include "updater.h"
#include "config.h"


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTranslator *trans = new QTranslator; // 分配内存
    if (!trans->load(":/language/en.qm")) {
        qDebug() << "没有找到翻译文件";
    }
    a.installTranslator(trans);
    Updater u;

    // 要加一个连接服务器失败
    QObject::connect(&u, &Updater::updateFinished, [&]() {
        MainWindow *m = new MainWindow;
        m->show();
        u.accept();
    });

    u.show();
    u.checkUpdate();

    return a.exec();
}
